package com.vr.xuecheng.feign.fallback;

import com.vr.xuecheng.feign.client.CheckCodeClient;
import lombok.extern.log4j.Log4j2;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author hzh
 * @date 2025/03/22
 * 验证码服务熔断降级后的回调
 */
@Log4j2
@Component
public class CheckCodeFallbackFactory implements FallbackFactory<CheckCodeClient> {
    @Override
    public CheckCodeClient create(Throwable cause) {
        log.error("调用验证码服务失败：{}",cause.getMessage());
        return (key, code) -> false;
    }
}
